cmake_minimum_required(VERSION 3.10)
project(apollo-cpp-sdk)

add_definitions(-Wall -Wextra -std=c++11 -rdynamic)
set(CMAKE_CXX_COMPILER "g++")
set(CMAKE_C_COMPILER "gcc")
set(CXX_FLAGS -g -Wall -Wextra -Wconversion -std=c++11 -rdynamic)

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
	list(APPEND CXX_FLAGS "-Wno-null-dereference")
	list(APPEND CXX_FLAGS "-Wno-sign-conversion")
	list(APPEND CXX_FLAGS "-Wno-unused-local-typedef")
	list(APPEND CXX_FLAGS "-Wthread-safety")
	list(REMOVE_ITEM CXX_FLAGS "-rdynamic")
endif()

aux_source_directory(src SRC)
include_directories(include)

add_library(apollo-client SHARED ${SRC})
target_link_libraries(apollo-client curl)
target_include_directories(apollo-client PUBLIC include)

add_executable(getConfigFromServerTest tests/getConfigFromServerTest.cpp ${SRC})
target_link_libraries(getConfigFromServerTest curl)
add_executable(getConfigTests tests/getConfigTests.cpp ${SRC})
target_link_libraries(getConfigTests curl)

set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
